<?php
	//if($_POST[Submit]){
	set_time_limit(3000);
	//set up basic connection
	$ftp_server = "10.176.200.200";
	$ftp_user_name = "isc";
	$ftp_user_pass = "isc;2014";
	$destination_file = uniqid().'_'.$_FILES['file']['name'];
	$source_file = $_FILES['file']['tmp_name'];
	$size_file=$_FILES['file']['size'];
	$conn_id = ftp_connect($ftp_server);
 
	// login with username and password
	$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); 

	ftp_chdir($conn_id,"");
	// check connection  
 	if ((!$conn_id) || (!$login_result)) {
    	echo "FTP connection has failed!";
    	echo "Attempted to connect to $ftp_server for user $ftp_user_name";
    	exit;
 	} else {
    	echo "Connected to $ftp_server, for user $ftp_user_name<br/>";     
 	}      
	
	// upload the file  
	$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);    

	// check upload status  
 	if (!$upload) {
     echo "FTP upload has failed!";
  	} else {
  		// redirect to convert.php (stream server) and $_POST['$destination_file'] when upload complete
		header("Location: http://10.176.200.200/server/convert/index.php?vdo_name=$destination_file");
  	}

	// close the FTP stream  
	ftp_close($conn_id);//}//end $_POST[Submit]

?>